﻿using IoTClient.Clients.PLC;
using IoTClient.Common.Enums;
using IoTClient.Enums;
using OpenIotModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace OpenIotMain.Tools {
    internal class ClientDrive {

        public SiemensClient siemensClient(Device device) {
            SiemensVersion siemensVersion =new SiemensVersion();
            // 根据 Device 的 DriverName 和 version 属性生成相应的 SiemensVersion
            if (device.DriverName == "SiemensVersion" && device.version == "S7_200Smart") {
                siemensVersion = SiemensVersion.S7_200Smart;
            }
            else if (device.DriverName == "SiemensVersion" && device.version == "S7_1200") {
                siemensVersion = SiemensVersion.S7_1200;
            }
            else {
                return null;
            }
            SiemensClient client = new SiemensClient(siemensVersion, device.ip, 102);
            return client;
        }
    }
}
